/*
function foo(arg1:string,arg2:string,arg3:string):string[]{
    return [arg1,arg2,arg3]
}

function foo(arg1:number,arg2:number,arg3:number):number[]{
    return [arg1,arg2,arg3]
}

function foo(arg1:boolean,arg2:boolean,arg3:boolean):boolean[]{
    return [arg1,arg2,arg3]
}
*/
/**
 * 泛型在函数中的使用
 * function 函数名<T>(arg:T):T{}
 */

function foo1<T>(arg1:T,arg2:T,arg3:T):T[]{
    return [arg1,arg2,arg3]
}

//调用方法的时候指定类型
console.log(foo1<number>(10,20,30));
console.log(foo1<string>("杨玉环","王昭君","小乔"));
interface StudentType{
    name:string
    age:number
    major:string
}
console.log(foo1<StudentType>({name:'熊保平',age:23,major:'计算机科学与技术'},{name:'小红',age:22,major:'英语'},{name:'小熊',age:25,major:'计算机网络'})
);
 
